dart compare two lists

66

if (list1.any((item) => list2.contains(item))) {
    // Lists have at least one common element
} else {
    // Lists DON'T have any common element
}
Function eq = const ListEquality().equals;
print(eq([1,'two',3], [1,'two',3])); // => true

Comments

Submit
0 Comments